﻿using System;
using Dexter.CallContext;
using Dexter.Logger.Contracts;

namespace Dexter.Services.Implementation {
	/// <summary>
	/// 	The implementation of <see cref = "IBackOfficeUrlBuilder" />.
	/// </summary>
	public class BackOfficeUrlBuilder : UrlBuilderBase, IBackOfficeUrlBuilder {

		/// <summary>
		/// Initializes a new instance of the <see cref="BackOfficeUrlBuilder"/> class.
		/// </summary>
		/// <param name="logger">The logger.</param>
		/// <param name="dexterContext">The dexter context.</param>
		/// <param name="configurationService">The configuration service.</param>
		public BackOfficeUrlBuilder ( ILogger logger , IDexterContext dexterContext , IConfigurationService configurationService ) : base ( logger , dexterContext , configurationService ) {}

		/// <summary>
		/// 	Gets the pingback url.
		/// </summary>
		/// <example>
		/// 	http://dexterblogengine.com/Admin
		/// </example>
		public string Home {
			get {
				return ToCaseConfiguration ( new Uri ( HomePage, "Admin/" ) );
			}
		}

		/// <summary>
		/// 	Gets the new post url.
		/// </summary>
		/// <example>
		/// 	http://dexterblogengine.com/Admin/Page/Edit
		/// </example>
		public string NewPage {
			get {
				return ToCaseConfiguration ( new Uri ( HomePage, "Admin/Page/Editor/" ) );
			}
		}

		/// <summary>
		/// 	Gets the new post url.
		/// </summary>
		/// <example>
		/// 	http://dexterblogengine.com/Admin/Post/Edit
		/// </example>
		public string NewPost {
			get {
				return ToCaseConfiguration ( new Uri ( HomePage, "Admin/Post/Editor/" ) );
			}
		}

		/// <summary>
		/// 	Gets the post list url.
		/// </summary>
		/// <example>
		/// 	http://dexterblogengine.com/Admin/Page/
		/// </example>
		public string PageList {
			get {
				return ToCaseConfiguration ( new Uri ( HomePage, "Admin/Page/" ) );
			}
		}

		/// <summary>
		/// 	Gets the post list url.
		/// </summary>
		/// <example>
		/// 	http://dexterblogengine.com/Admin/Post/
		/// </example>
		public string PostList {
			get {
				return ToCaseConfiguration ( new Uri ( HomePage, "Admin/Post/" ) );
			}
		}

		/// <summary>
		/// 	Gets the post list url.
		/// </summary>
		/// <example>
		/// 	http://dexterblogengine.com/Admin/Category/
		/// </example>
		public string CategoryList {
			get {
				return ToCaseConfiguration ( new Uri ( HomePage, "Admin/Category/" ) );
			}
		}

		/// <summary>
		/// 	Gets the new post url.
		/// </summary>
		/// <example>
		/// 	http://dexterblogengine.com/Admin/Category/Edit
		/// </example>
		public string NewCategory {
			get {
				return ToCaseConfiguration ( new Uri ( HomePage, "Admin/Category/Editor/" ) );
			}
		}

		/// <summary>
		/// 	Gets the post list url.
		/// </summary>
		/// <example>
		/// 	http://dexterblogengine.com/Admin/Account/
		/// </example>
		public string UserList {
			get {
				return ToCaseConfiguration ( new Uri ( HomePage, "Admin/Account/" ) );
			}
		}

		/// <summary>
		/// 	Gets the export post url.
		/// </summary>
		/// <example>
		/// 	http://dexterblogengine.com/Backup/Posts
		/// </example>
		public string ExportPost {
			get {
				return ToCaseConfiguration ( new Uri ( HomePage, "Admin/Backup/Posts/" ) );
			}
		}

		/// <summary>
		/// 	Gets the export post url.
		/// </summary>
		/// <example>
		/// 	http://dexterblogengine.com/Backup/ExportConfiguration
		/// </example>
		public string ExportConfiguration {
			get {
				return ToCaseConfiguration ( new Uri ( HomePage, "Admin/Backup/ExportConfiguration/" ) );
			}
		}

		/// <summary>
		/// 	Gets the export post url.
		/// </summary>
		/// <example>
		/// 	http://dexterblogengine.com/admin/settings/site
		/// </example>
		public string SiteConfiguration {
			get {
				return ToCaseConfiguration ( new Uri ( HomePage, "Admin/Settings/Site/" ) );
			}
		}

		/// <summary>
		/// 	Gets the export post url.
		/// </summary>
		/// <example>
		/// 	http://dexterblogengine.com/admin/settings/RebuildSearchIndex
		/// </example>
		public string RebuildSearchIndex {
			get {
				return ToCaseConfiguration ( new Uri ( HomePage, "Admin/Settings/RebuildSearchIndex/" ) );
			}
		}

		/// <summary>
		/// Gets the export post url.
		/// </summary>
		/// <example>
		/// http://dexterblogengine.com/admin/settings/PluginSettings
		///   </example>
		public string PluginSettings {
			get
			{
				return ToCaseConfiguration(new Uri(HomePage, "Admin/Settings/PluginSettings/"));
			}
		}

		/// <summary>
		/// 	Gets the export post url.
		/// </summary>
		/// <example>
		/// 	http://dexterblogengine.com/admin/statistics/referrers
		/// </example>
		public string Referrers {
			get {
				return ToCaseConfiguration ( new Uri ( HomePage, "Admin/Statistics/Referrers/" ) );
			}
		}

		/// <summary>
		/// 	Gets the export post url.
		/// </summary>
		/// <example>
		/// 	http://dexterblogengine.com/admin/backup/comments
		/// </example>
		public string CommentsExport {
			get {
				return ToCaseConfiguration ( new Uri ( HomePage, "Admin/Backup/Comments/" ) );
			}
		}

		public string ImportPosts {
			get { return ToCaseConfiguration(new Uri(HomePage, "Admin/Backup/ImportPosts/")); }
		}
	}
}
